package com.lxmes.procontrol.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lxmes.common.annotation.Log;
import com.lxmes.common.core.controller.BaseController;
import com.lxmes.common.core.domain.AjaxResult;
import com.lxmes.common.enums.BusinessType;
import com.lxmes.procontrol.domain.NcProLineMonitoring;
import com.lxmes.procontrol.service.INcProLineMonitoringService;
import com.lxmes.common.utils.poi.ExcelUtil;
import com.lxmes.common.core.page.TableDataInfo;

/**
 * 生产过程管理总表Controller
 * /procontrol/proLineMonitoring/list
 * @author ruoyi
 * @date 2022-11-23
 */
@RestController
@RequestMapping("/procontrol/proLineMonitoring")
public class NcProLineMonitoringController extends BaseController
{
    @Autowired
    private INcProLineMonitoringService ncProLineMonitoringService;

    /**
     * 查询生产过程管理总表列表
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:list')")
    @GetMapping("/list")
    public TableDataInfo list(NcProLineMonitoring ncProLineMonitoring)
    {
        startPage();
        List<NcProLineMonitoring> list = ncProLineMonitoringService.selectNcProLineMonitoringList(ncProLineMonitoring);
        return getDataTable(list);
    }

    /**
     * 导出生产过程管理总表列表
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:export')")
    @Log(title = "生产过程管理总表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NcProLineMonitoring ncProLineMonitoring)
    {
        List<NcProLineMonitoring> list = ncProLineMonitoringService.selectNcProLineMonitoringList(ncProLineMonitoring);
        ExcelUtil<NcProLineMonitoring> util = new ExcelUtil<NcProLineMonitoring>(NcProLineMonitoring.class);
        util.exportExcel(response, list, "生产过程管理总表数据");
    }

    /**
     * 获取生产过程管理总表详细信息
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ncProLineMonitoringService.selectNcProLineMonitoringById(id));
    }

    /**
     * 新增生产过程管理总表
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:add')")
    @Log(title = "生产过程管理总表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NcProLineMonitoring ncProLineMonitoring)
    {
        return toAjax(ncProLineMonitoringService.insertNcProLineMonitoring(ncProLineMonitoring));
    }

    /**
     * 修改生产过程管理总表
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:edit')")
    @Log(title = "生产过程管理总表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NcProLineMonitoring ncProLineMonitoring)
    {
        return toAjax(ncProLineMonitoringService.updateNcProLineMonitoring(ncProLineMonitoring));
    }

    /**
     * 删除生产过程管理总表
     */
    @PreAuthorize("@ss.hasPermi('procontrol:proLineMonitoring:remove')")
    @Log(title = "生产过程管理总表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ncProLineMonitoringService.deleteNcProLineMonitoringByIds(ids));
    }
}
